<?php
declare (strict_types=1);

namespace app\store\model;

use app\common\model\SupplierBank as SupplierBankModel;

/**
 * 供应商与银行卡关系模型
 * Class GoodsCategoryRel
 * @package app\store\model
 */
class SupplierBank extends SupplierBankModel
{

    /**
     * 新增供应商的银行卡
     * @param int $supplierId
     * @param array $supplierBank
     * @return array|bool|false
     */
    public static function add(int $supplierId, array $supplierBank = [])
    {
        return (new static)->save(array_merge($supplierBank, [
            'supplier_id' => $supplierId,
            'store_id' => self::$storeId,
            'create_time' => time()
        ]));
        return false;
    }
    /**
     * 更新银行卡信息
     * @param int $supplierId
     * @param array $supplierBank
     * @return array|bool|false
     */
    public static function edit(int $supplierId, array $supplierBank = [])
    {
        // 删除所有的银行卡
        static::deleteAll(['supplier_id' => $supplierId]);
        // 新增银行卡
        return static::add($supplierId,$supplierBank);
    }
}
